package com.example.model.vo;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.ai.chat.messages.Message;

@Data
@NoArgsConstructor
public class MessageVO {
    private String role;
    private String content;

    // 构造函数
    public MessageVO(Message message) {
        //我们从message中获取role和content
        switch (message.getMessageType()){
            //保留下来我们需要的角色
            case USER -> this.role = "user";
            case ASSISTANT -> this.role = "assistant";
            default -> this.role = "";
        }
        this.content = message.getText();
    }
}
